home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CURSOR.SWG / 0023_Cursor Unit.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  2KB  |  79 lines

  1. Unit Cursor;  { Cursor.Pas }
  2.  
  3. interface
  4.  
  5. const
  6. CursorOn  = True;
  7. CursorOff = False;
  8.  
  9. { Cursor shapes }
  10.  
  11. ThinCursor    = $0707; { Thin cursor }
  12. OvrCursor     = $0307; { Overwrite cursor }
  13. InsCursor     = $0607; { Insert cursor (default) }
  14. BarCursor     = $000D; { Bar cursor }
  15.  
  16. procedure SetCursor(CursorFlag : boolean);
  17. function GetCursorType : word;
  18. function SetCursorType(Shape : word) : word;
  19.  
  20. implementation
  21.  
  22. uses Crt;
  23.  
  24. var
  25. CursorShape : word;
  26.  
  27. Procedure SetCursor; assembler;
  28.  
  29. { Sets the cursor on/off using the current value of the global
  30. CursorShape variable. Monochrome monitors supported }
  31. Asm
  32. CMP CursorFlag,True
  33. JNE @@2
  34. CMP BYTE PTR [LastMode],Mono
  35. JE  @@1
  36. MOV CX,CursorShape  { Switch on cursor using the default shape }
  37. JMP @@4
  38. @@1:
  39. MOV CX,0B0Ch  { Switch on mono cursor }
  40. JMP @@4
  41. @@2:
  42. CMP BYTE PTR [LastMode],Mono
  43. JE  @@3
  44. MOV CX,2000h  { Switch off cursor }
  45. JMP @@4
  46. @@3:
  47. XOR CX,CX     { Switch off mono cursor }
  48. @@4:
  49. MOV AH,01h
  50. XOR BH,BH
  51. INT 10h
  52. End; { SetCursor }
  53.  
  54. Function GetCursorType;
  55.  
  56. { Returns the current cursor shape/type in word }
  57.  
  58. Begin
  59. GetCursorType := MemW[Seg0040:$0060]
  60. End; { GetCursorType }
  61.  
  62. Function SetCursorType; assembler;
  63.  
  64. { Sets new cursor type/shape. Old cursor shape is returned }
  65.  
  66. Asm
  67. MOV AX,CursorShape { save old value }
  68. MOV BX,Shape
  69. CMP BYTE PTR [LastMode],Mono
  70. JNE @@1
  71. XOR BX,BX { Switch off mono cursor }
  72. @@1:
  73. MOV CursorShape,BX
  74. End; { SetCursorType }
  75.  
  76. Begin
  77. CursorShape := GetCursorType
  78. End. { Cursor.Pas }
  79.